<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Tabib Apps web | Admin Dashboard Template</title>
    <!-- Base Styling  -->
    <link rel="stylesheet" href="static/css/fonts.css">
    <link rel="stylesheet" href="static/css/style.css">
</head>

<body>
    <div id="main-wrapper" class="show">


        <!-- start logo components -->
        <div class="nav-header">
            <div class="brand-logo">
                <a href="index.html"> <img class="logo-tabib" src="static/picture/download.png" alt=""></a>
                <a href="index.html"><img class="brand-title" src="static/picture/logo.png" alt=""></a>
            </div>
        </div>
        <!-- End logo components -->


        <!-- start section sidebar -->
        <aside class="left-panel nicescroll-box">
            <nav class="navigation">
                <ul class="list-unstyled main-menu">
                    <li class="has-submenu">
                        <a href="index.html">
                            <i class="fas fa-th-large"></i>
                            <span class="nav-label">首页</span>
                        </a>
                    </li>
                    <li class="has-submenu">
                        <a href="#" class="has-arrow mm-collapsed">
                            <i class="fas fa-user-md"></i>
                            <span class="nav-label">医生</span>
                        </a>
                        <ul class="list-unstyled mm-collapse">
                            <li><a href="new-patient.html">查看患者信息</a></li>
                            <li><a href="all-patients.html">所有患者</a></li>
                        </ul>
                    </li>
                    <li class="has-submenu">
                        <a href="#" class="has-arrow mm-collapsed">
                            <i class="fas fa-book-medical"></i>
                            <span class="nav-label">处方</span>
                        </a>
                        <ul class="list-unstyled mm-collapse">
                            <li><a href="new-prescription.html">新处方</a></li>
                            <li><a href="allPrescriptions.html">所有处方</a></li>
                        </ul>
                    </li>
                    <li class="has-submenu">
                        <a href="calendars.html">
                            <i class="fas fa-calendar-alt"></i>
                            <span class="nav-label">排班时间</span>
                        </a>
                    </li>
                </ul>
            </nav>
            <div class="sidebar-widgets">
                <div class="top-sidebar box-shadow mx-25 m-b-30 p-b-20 text-center">
                    <a href="new-appointment.html">
                        <img src="static/picture/appointement.svg" class="side-img" alt="img">
                    </a>
                    <a href="#">
                        <h4 class="text-primary mb-0">Make an Appointments</h4>
                    </a>
                </div>
                <div class="copyright text-center">
                    <p class="mb-0"> Tabib Dashboard</p>
                    <p class="mb-0"> © 2021 </p>
                </div>
            </div>
        </aside>
        <!-- End section sidebar -->


        <!-- start section header -->
        <div class="header">
            <header class="top-head container-fluid">
                <div class="nav-control">
                </div>
                <div class="header-right">
                    <div class="fullscreen notification_dropdown">
                        <div class="full">
                            <a class="text-dark" href="#!" onclick="javascript:toggleFullScreen()">
                                <i class="fas fa-expand"></i>
                            </a>
                        </div>
                    </div>
                    <div class="notification_dropdown">
                        <div class="cart-wrapper">
                            <div class="cart-icon">
                                <a class="cart-control" href="#">
                                    <i class="fas fa-bell"></i>
                                    <div class="pulse-css"></div>
                                </a>
                            </div>
                            <div class="cart-dropdown-form dropdown-container">
                                <div class="form-content">
                                    <div class="widget-media main-scroll nicescroll-box">
                                        <ul class="timeline">
                                            <li>
                                                <h6 class="mb-0">通知</h6>
                                            </li>
                                            <li>
                                                <div class="timeline-panel">
                                                    <div class="media mr-2">
                                                        <img alt="image" src="static/picture/1.jpg">
                                                    </div>
                                                    <div class="media-body">
                                                        <h6 class="mb-1 ">Incoming Message</h6>
                                                        <small class="d-block">29 July 2020 - 02:26 PM</small>
                                                    </div>
                                                </div>
                                            </li>
                                        </ul>
                                    </div>
                                    <a class="all-notification btn btn-primary" href="#">
                                        查看所有通知
                                    </a>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="my-account-wrapper">
                        <div class="account-wrapper">
                            <div class="account-control">
                                <a class="login header-profile" href="#" title="Sign in">
                                    <div class="header-info">
                                        <span id="nickname">Dr Roberts</span>
                                        <small>医生</small>
                                    </div>
                                    <img src="static/picture/client.jpg" alt="people" id="img">
                                </a>
                                <div class="account-dropdown-form dropdown-container">
                                    <div class="form-content">
                                        <a href="chat.html">
                                            <i class="far fa-user"></i>
                                            <span class="ml-2">在线聊天</span>
                                        </a>
                                        <a href="login.html">
                                            <i class="fas fa-sign-in-alt"></i>
                                            <span class="ml-2">退出 </span>
                                        </a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </header>
        </div>
        <!-- End section header -->


        <!-- start section content -->
        <div class="content-body">
            <div class="warper container-fluid">
                <div class="all_prescriptions main_container">
                    <div class="row page-titles mx-0">
                        <div class="col-sm-6 p-md-0">
                            <div class="welcome-text">
                                <h4 class="text-primary">所有处方</h4>
                            </div>
                        </div>
                        <div class="col-sm-6 p-md-0 justify-content-sm-end mt-2 mt-sm-0 d-flex">
                            <ol class="breadcrumb">
                                <li class="breadcrumb-item"><a href="index.html">首页</a></li>
                                <li class="breadcrumb-item active"><a href="javascript:;">处方</a>
                                </li>
                            </ol>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-lg-12">
                            <div class="card">
                                <div class="card-header fix-card">
                                    <div class="row">
                                        <div class="col-8">
                                            <h4 class="card-title"> 所有处方</h4>
                                        </div>
                                        <div class="col-4">
                                            <a href="javascript:;" class="btn btn-primary float-end">处方
                                                 </a>
                                        </div>
                                    </div>
                                </div>
                                <div class="card-body">
                                    <div class="table-responsive">
                                        <table id="example1" class="display nowrap">
                                            <thead>
                                                <tr>
                                                    <th>患者名字</th>
                                                    <th>日期 </th>
                                                    <th>处方内容</th>
                                                    <th>支付金额</th>
                                                    <th>编辑</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- End section content -->


        <!-- start section footer -->
        <div class="footer">
            <div class="copyright">
                <p class="mb-0">Copyright &copy; 2021.Company name All rights reserved.<a target="_blank" href="http://www.cssmoban.com/">&#x7F51;&#x9875;&#x6A21;&#x677F;</a></p>
            </div>
        </div>
        <!-- End section footer -->


    </div>


    <!-- JQuery v3.5.1 -->
    <script src="static/js/jquery.min.js"></script>

    <script src="static/js/jquery-3.6.0.js"></script>

    <!-- popper js -->
    <script src="static/js/popper.min.js"></script>

    <!-- Bootstrap -->
    <script src="static/js/bootstrap.min.js"></script>

    <!-- Moment -->
    <script src="static/js/moment.min.js"></script>

    <!-- Date Range Picker -->
    <script src="static/js/daterangepicker.min.js"></script>

    <!-- Datatable -->
    <script src="static/js/jquery.dataTables.min.js"></script>
    <script src="static/js/init-tdatatable.js"></script>

    <!-- Main Custom JQuery -->
    <script src="static/js/toggleFullScreen.js"></script>
    <script src="static/js/main.js"></script>

</body>
<script>
    $(document).ready(function () {
        $.ajax({
            type: "GET",
            url: "/doctor/session",
            contentType: "application/x-www-form-urlencoded",
            dataType: "json"
        }).done((result)=>{
            if (result.data!=null){
                //登录
                //切换样式
                $(".loginTop").css("display","none");
                $(".collapsible_menu").css("display","block");
                //设置登录用户昵称
                $("#nickname").text(result.data.doctorName);

                $("#img").attr("src",result.data.image);
            }
        }).fail(()=>{
            alert("doctor/session request fail");
        });
        //退出登录
        $(".dropdown-container .form-content a").last().click(function () {
            //发送xhr
            $.getJSON("/doctor/logout",function (result) {
                //切换未登录状态
                $(".loginTop").css("display","block");
                $(".collapsible_menu").css("display","none");
            });
        });
    })
</script>
<script>

    $(document).ready(function () {
        $.ajax({
            type: "get",
            url: "/order/PayAndDetailList",
            data:{
                patientId:localStorage.getItem("patientId")
            },
            contentType: "application/x-www-form-urlencoded",
            dataType: "json"
        }).done((result)=>{
            if (result.data!=null){
                $.each(result.data,function (index,obj){
                    let patientName=obj.patient.patientName
                    $.each(obj.payList,function (index,obj){
                        let creatTime=obj.createTime;
                        $.each(obj.detailList,function (index,obj){
                            ex1.row.add([patientName,creatTime,obj.content,obj.money,'<a class="mr-4 delet" onclick="delet(this)"><span class="fas fa-trash-alt"></span></a>']);
                            ex1.draw();
                        })
                    })
                })
            }
        })

    })
</script>
<script>
    function delet(val){
        $.ajax({
            type: "get",
            url: "/detail/delete",
            data:{
                patientId:localStorage.getItem("patientId")
            },
            contentType: "application/x-www-form-urlencoded",
            dataType: "json"
        }).done((result)=>{
            if (result.data == true){
                alert("删除成功")
                location.reload();
            }
        })

    }
</script>
</html>